//
//  OrderCell.m
//  WGFGlobalHouses
//
//  Created by welldone on 15/5/18.
//  Copyright (c) 2015年 waiguofang. All rights reserved.
//

#import "OrderCell.h"
#import "ProgressView.h"
#import "config.h"
#import "UIImageView+WebCache.h"



@interface OrderCell ()

@property (nonatomic,strong)ProgressView *proView;

@property (weak, nonatomic) IBOutlet UILabel *orderId;
@property (weak, nonatomic) IBOutlet UILabel *orderTime;

@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *subTitle;
@property (weak, nonatomic) IBOutlet UILabel *dolLab;
@property (weak, nonatomic) IBOutlet UILabel *rmbLab;
@property (weak, nonatomic) IBOutlet UIView *progressContenView;

@end


@implementation OrderCell




+(instancetype) cellWithTableView:(UITableView *)tableview{

    static NSString *ID = @"OrderCell";
    OrderCell *cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil)
    {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"OrderCell" owner:nil options:nil]lastObject];
        
        [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
        
        
        cell.proView = [ProgressView creatView];
        [cell.proView setFrame:CGRectMake(0, 10, cell.progressContenView.frame.size.width, cell.progressContenView.frame.size.height-20)];
        [cell.progressContenView addSubview:cell.proView];
    }
    
    return cell;
}



+(CGFloat)getHight:(OrderData*)data withTableView:(UITableView*)tableView{


    return 216;
}





-(void)setData:(OrderData*)data{
    
    [self.img sd_setImageWithURL:[NSURL URLWithString:data.imgUrl] placeholderImage:[UIImage imageNamed:DEFAULT_IMG]];
    [self.orderId setText:data.orderCode];
    [self.orderTime setText:data.time];
    [self.title setText:data.title];
    [self.subTitle setText:data.subTitle];
    [self.dolLab setText:data.dol];
    [self.rmbLab setText:[NSString stringWithFormat:@"约: %@万",data.rbm]];
    
    [self.proView setPogressState:data.state];
}


@end
